<template>
  <div style="margin-top: 20px">
    <div class="view-equip-title">基础信息</div>
    <div class="view-equip-wrap">
      <div class="view-equip-content">
        <div class="view-equip-item">
          <div class="label">点检任务编号</div>
          <div class="text">{{ taskDetailData.taskNo }}</div>
        </div>
        <div class="view-equip-item">
          <div class="label">科室</div>
          <div class="text">{{ taskDetailData.classNameDesc }}</div>
        </div>
        <div class="view-equip-item">
          <div class="label">系统</div>
          <div class="text">{{ taskDetailData.systemCodeDesc }}</div>
        </div>
      </div>
      <div class="view-equip-content">
        <div class="view-equip-item">
          <div class="label">设备编号</div>
          <div class="text">{{ taskDetailData.eqpId }}</div>
        </div>
        <div class="view-equip-item">
          <div class="label">设备名称</div>
          <div class="text">{{ taskDetailData.eqpName }}</div>
        </div>
        <div class="view-equip-item">
          <div class="label">设备位置</div>
          <div class="text">{{ taskDetailData.positionName }}</div>
        </div>
      </div>
      <div class="view-equip-content">
        <div class="view-equip-item">
          <div class="label">任务开始时间</div>
          <div class="text">{{ taskDetailData.startTime }}</div>
        </div>
        <div class="view-equip-item">
          <div class="label">任务结束时间</div>
          <div class="text">{{ taskDetailData.endTime }}</div>
        </div>
        <div v-if="taskDetailData.taskStatus === 3" class="view-equip-item">
          <div class="label">执行人</div>
          <div class="text">{{ taskDetailData.executorName }}</div>
        </div>
        <div v-else class="view-equip-item">
          <div class="label">任务分配</div>
          <div class="text">{{ taskDetailData.groupCodeName }}</div>
        </div>
      </div>
      <div class="view-equip-content">
        <div class="view-equip-item">
          <div class="label">任务领取时间</div>
          <div class="text">{{ taskDetailData.acceptTime }}</div>
        </div>
        <div class="view-equip-item large">
          <div class="label">任务完成时间</div>
          <div class="text">{{ taskDetailData.finishTime }}</div>
        </div>
      </div>
    </div>
    <!-- <div class="view-equip-title">异常信息</div>
    <div class="view-equip-wrap">
      <div class="view-equip-content">
        <div class="view-equip-item middle">
          <div class="label">异常来源</div>
          <div class="text">{{ taskDetailData.unnormalSourceDesc }}</div>
        </div>
        <div class="view-equip-item middle">
          <div class="label">异常单号</div>
          <div class="text">{{ taskDetailData.relatedOrderNum }}</div>
        </div>
      </div>
      <div class="view-equip-content">
        <div class="view-equip-item plus">
          <div class="label">异常描述</div>
          <div class="text">{{ taskDetailData.unnormalDesc }}</div>
        </div>
      </div>
      <div class="view-equip-content">
        <div class="view-equip-item plus">
          <div class="label">异常图片</div>
          <div class="text">
            <PhotoUpload photoType="view" :photoList="taskDetailData.imageIds" />
          </div>
        </div>
      </div>
      <div class="view-equip-content">
        <div class="view-equip-item plus">
          <div class="label">点检建议</div>
          <div class="text">{{ taskDetailData.checkAdvice }}</div>
        </div>
      </div>
    </div> -->
    <div v-if="taskDetailData.taskStatus === 3">
      <div v-if="taskDetailData.contentItemList && taskDetailData.contentItemList.length !== 0">
        <div class="view-equip-title">点检内容</div>
        <div v-for="(item, index) in taskDetailData.contentItemList" :key="index">
          <EditDropDown :dropdownTitle="item.checkContentName">
            <template v-slot:content>
              <px-table :data="item.pointCheckContentItemList" style="margin-bottom: 18px" class="equip-table" size="small" max-height="400" border>
                <px-table-column fixed="left" prop="checkItem" label="巡检项" min-width="160" show-overflow-tooltip />
                <px-table-column prop="checkContent" label="巡检内容" min-width="140" show-overflow-tooltip />
                <px-table-column prop="result" label="巡检结果" min-width="100" show-overflow-tooltip />
                <px-table-column prop="executeByName" label="执行人" min-width="120" show-overflow-tooltip />
                <px-table-column prop="execTime" label="执行时间" min-width="150" show-overflow-tooltip />
              </px-table>
            </template>
          </EditDropDown>
        </div>
      </div>
      <div style="margin-top: 20px" class="view-equip-title">异常上报</div>
      <div class="view-equip-wrap">
        <div class="view-equip-content">
          <div class="view-equip-item plus">
            <div class="label">异常照片</div>
            <div class="text">
              <PhotoUpload photoType="view" :photoData="{ moduleName: moduleName }" :photoList="taskDetailData.images" />
            </div>
          </div>
        </div>
        <div class="view-equip-content">
          <div class="view-equip-item plus">
            <div class="label">备注</div>
            <div class="text">{{ taskDetailData.unnormalReport }}</div>
          </div>
        </div>
      </div>
    </div>
    <div v-else>
      <div v-if="taskDetailData.contentList && taskDetailData.contentList.length !== 0">
        <div class="view-equip-title">点检内容</div>
        <div v-for="(item, index) in taskDetailData.contentList" :key="index">
          <EditDropDown :dropdownTitle="item.checkContentName">
            <template v-slot:content>
              <px-table :data="item.pointCheckContentItemList" style="margin-bottom: 18px" class="equip-table" size="small" max-height="400" border>
                <px-table-column fixed="left" type="index" label="序号" width="60" />
                <px-table-column fixed="left" prop="checkItem" label="巡检项" min-width="160" show-overflow-tooltip />
                <px-table-column prop="checkContent" label="巡检内容" min-width="100" show-overflow-tooltip />
                <px-table-column prop="checkContentRangeValue" label="内容范围" min-width="160" show-overflow-tooltip>
                  <template #default="scope">
                    <div v-if="scope.row.checkContentRange === 1">文本</div>
                    <div v-if="scope.row.checkContentRange === 2">数字</div>
                    <div v-if="scope.row.checkContentRange === 3">判断：{{ scope.row.checkContentRangeValue || "-" }}</div>
                    <div v-if="scope.row.checkContentRange === 4">选择：{{ scope.row.checkContentRangeValue || "-" }}</div>
                  </template>
                </px-table-column>
              </px-table>
            </template>
          </EditDropDown>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import PhotoUpload from "@/components/Upload/PhotoUpload.vue";
import EditDropDown from "@/views/all/equip/components/EditDropDown.vue";

// 父级传过来的值
const props = defineProps(["taskDetailData", "moduleName"]);
</script>

<style lang="scss" scoped>
@import url("@/views/all/equip/scss/view-detail.scss");
</style>
